package com.ruoyi.business.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.CommunityScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi. business.mapper.BizCouponMapper;
import com.ruoyi. business.domain.BizCoupon;
import com.ruoyi. business.service.IBizCouponService;

/**
 * 券码信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-19
 */
@Service
public class BizCouponServiceImpl implements IBizCouponService 
{
    @Autowired
    private BizCouponMapper bizCouponMapper;

    /**
     * 查询券码信息
     * 
     * @param couponId 券码信息主键
     * @return 券码信息
     */
    @Override
    public BizCoupon selectBizCouponByCouponId(Long couponId)
    {
        return bizCouponMapper.selectBizCouponByCouponId(couponId);
    }

    /**
     * 查询券码信息列表
     * 
     * @param bizCoupon 券码信息
     * @return 券码信息
     */
    @Override
    @CommunityScope(alias = "")
    public List<BizCoupon> selectBizCouponList(BizCoupon bizCoupon)
    {
        return bizCouponMapper.selectBizCouponList(bizCoupon);
    }

    /**
     * 新增券码信息
     * 
     * @param bizCoupon 券码信息
     * @return 结果
     */
    @Override
    public int insertBizCoupon(BizCoupon bizCoupon)
    {
        bizCoupon.setCreateTime(DateUtils.getNowDate());
        return bizCouponMapper.insertBizCoupon(bizCoupon);
    }

    /**
     * 修改券码信息
     * 
     * @param bizCoupon 券码信息
     * @return 结果
     */
    @Override
    public int updateBizCoupon(BizCoupon bizCoupon)
    {
        bizCoupon.setUpdateTime(DateUtils.getNowDate());
        return bizCouponMapper.updateBizCoupon(bizCoupon);
    }

    /**
     * 批量删除券码信息
     * 
     * @param couponIds 需要删除的券码信息主键
     * @return 结果
     */
    @Override
    public int deleteBizCouponByCouponIds(Long[] couponIds)
    {
        return bizCouponMapper.deleteBizCouponByCouponIds(couponIds);
    }

    /**
     * 删除券码信息信息
     * 
     * @param couponId 券码信息主键
     * @return 结果
     */
    @Override
    public int deleteBizCouponByCouponId(Long couponId)
    {
        return bizCouponMapper.deleteBizCouponByCouponId(couponId);
    }

    /**
     * 获取待审核的券
     *
     * @param audit
     * @return
     */
    @Override
    public long selectBizCouponByAudit(Integer audit) {
        return bizCouponMapper.selectBizCouponByAudit(audit);
    }

    /**
     * 创建的券总数
     *
     * @return
     */
    @Override
    // @CommunityScope(alias = "")
    public Long selectBizCouponTotal(BizCoupon bizCoupon) {
        return bizCouponMapper.selectBizCouponTotal(bizCoupon);
    }
}
